package com.sicheng.metadata.se.exp.first;

import java.io.IOException;

/**
 * @author zsc
 * @version 1.0
 * @date 2021/9/9 20:52
 */
public class Factorial {
    public static void main(String[] args) throws IOException {
//        System.out.println("请输入n:");
//        System.out.println("n! = "+factorial(new  Scanner(System.in).nextInt()) );
    }

    public static int factorial(int n) {
        if (n < 0)
            throw new RuntimeException("n不能小于0");
        if (n == 1 || n == 0)
            return 1;
        else return factorial(n - 1) * n;
    }
}
